package com.yy.personalcv.service.impl;

import com.yy.personalcv.mapper.EducationMapper;
import com.yy.personalcv.pojo.Education;
import com.yy.personalcv.service.EducationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class EducationServiceImpl implements EducationService {

    @Resource
    private EducationMapper educationMapper;
    @Override
    public List<Education> selectTen(Map map) {
        return educationMapper.selectTen(map);
    }

    @Override
    public int getEducationCounts(int uid) {
        return educationMapper.getEducationCounts(uid);
    }

    @Override
    public Education getEducationDetail(int id, int uid) {
        return educationMapper.getEducationDetail(id, uid);
    }

    @Override
    public void addEducation(Education education) {
        education.setModified(new Date());
        education.setDisplay(1);
        educationMapper.addEducation(education);
    }

    @Override
    public void deleteEducation(int id, int uid) {
        educationMapper.deleteEducation(id, uid);
    }

    @Override
    public void updateEducation(Education education) {
        education.setModified(new Date());
        educationMapper.updateEducation(education);
    }

    @Override
    public List<Education> selectAll(int uid) {
        return educationMapper.selectAll(uid);
    }


}
